package org.jgs1904.config;

import org.jgs1904.pojo.Dog;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import javax.swing.*;
import java.awt.dnd.DropTarget;

/**
 * @author: 默苍璃
 * @date: 2022-01-03 14:43
 * @Configuration 代表这是一个配置类 beans
 * @Import(MyConfig1.class) 导入合并其他配置类，类似于配置文件中的 Import 标签
 */
@Configuration
@Import(MyConfig1.class)
@ComponentScan("org.jgs1904.config")
public class MyConfig {

    /**
     * 通过方法注册一个bean，这里的返回值就Bean的类型，方法名就是bean的id！
     *
     * @return
     */
    @Bean(initMethod = "init",destroyMethod = "destroy")
    public Dog dog() {
        Dog dog = new Dog();
        dog.setName("wang~~~");
        return dog;
    }

    @Bean
    public Dog dropMode(){
        return new Dog();
    }

}
